#include "PrecompiledHeader_Engineer.h"
#include "CGame.h"

/*--------------------------------------------------------------------------*/

CGame::CGame() :
	EngMod("CGame", 0),
	IGame("EngineerGame")
{

}

/*--------------------------------------------------------------------------*/

CGame::~CGame()
{

}

/*--------------------------------------------------------------------------*/

void CGame::OnCreate()
{
	CContext::getInstance()->LoadContexts("../GameDataEngineer/engineer_contexts.xml");
	CResources::getInstance()->LoadResources("../GameDataEngineer/engineer_resources.xml");
	CMaterial::getInstance()->LoadMaterials("../GameDataEngineer/engineer_materials.xml");

	CSplashscreen::getInstance()->OnInit();
	CMainMenu::getInstance()->OnInit();
	CWorld::getInstance()->OnInit();

	this->OnInit();
}

/*--------------------------------------------------------------------------*/

void CGame::OnInit()
{
	this->AddGameMode(gm_splashscreen, CSplashscreen::getInstance());
	this->AddGameMode(gm_mainmenu, CMainMenu::getInstance());
	this->AddGameMode(gm_world, CWorld::getInstance());

	CShell::getInstance()->Execute("print('Welcome to EngineerGame!');");
	CShell::getInstance()->LoadScript("../Data/script/init.lua");

	ViaLactea::getInstance()->RegisterOnLoop(this, 0, 40, "CGame");
}

/*--------------------------------------------------------------------------*/

void CGame::OnLoop(const unsigned int i)
{
	switch (i)
	{
	case 0:
	{
		this->BindGameModeCalc();
		break;
	}
	}
}

/*--------------------------------------------------------------------------*/